﻿package hapi.mvc;

class DynamicView implements View {
	
	var context:Dynamic;
	
	public function new(?context=null) {
		this.context = context == null ? {} : context;
	}
	
	public function assign(name:String, value:Dynamic):Void {
		Reflect.setField(context, name, value);
	}
	
	public function assignDisplayable(value:Displayable):Void {
		value.displayOn(this);
	}
	
	public function display() {
		trace(this);
	}
	
	public function getContext() {
		return context;
	}
}